package cn.itcast.goods.user.DBConn;
import com.mysql.jdbc.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DbConn {
    public static final String url = "jdbc:mysql://127.0.0.1/goods";
    public static final String name = "com.mysql.jdbc.Driver";
    public static final String user = "root";
    public static final String password = "";
    public static Connection connection;
    public static Connection getConnection()
    {
        try{
            Class.forName(name);
            connection= (Connection) DriverManager.getConnection(url,user,password);
        }
        catch (ClassNotFoundException e)
        {
            throw new RuntimeException(e);
        }
        catch (SQLException e)
        {
            throw new RuntimeException(e);
        }

        return connection;
    }

}
